package cn.yiyuan.car.dto;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.GeoPointField;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @user m
 * @project car_mall_system
 * @date 2024-01-04
 * @package cn.yiyuan.car.dto
 */

/**
 * 车辆的es的文档操作类
 */
@Document(indexName = "yiyuan-car",type = "car")
@Data
public class Cardto {
    @Id
    private Long id;

    @Field(type = FieldType.Text, analyzer = "ik_smart", searchAnalyzer = "ik_smart")
    private String title;

    @Field(type = FieldType.Keyword)
    private String cover;

    @Field(type = FieldType.Double)
    private BigDecimal saleprice;

    @Field(type = FieldType.Double)
    private BigDecimal costprice;

    @Field(type = FieldType.Integer)
    private Integer isnew;

    @Field(type = FieldType.Date)
    private Date reigstertime;  // 上牌时间

    @Field(type = FieldType.Double)
    private Double mileage;

    @Field(type = FieldType.Long)
    private Long shopId;

    @Field(type = FieldType.Text, analyzer = "ik_smart", searchAnalyzer = "ik_smart")
    private String shopName;

    @Field(type = FieldType.Keyword)
    private String shopAddress;

    // 店铺的经纬度
    @GeoPointField
    private Double longitude;

    @GeoPointField
    private Double latitude;

    @Field(type = FieldType.Date)
    private Date onsaletime;

    @Field(type = FieldType.Integer)
    private Integer costeffective;

    @Field(type = FieldType.Integer)
    private Integer rushsale;

    @Field(type = FieldType.Integer)
    private Integer quasinewcar;

    @Field(type = FieldType.Integer)
    private Integer transitivecountry;

    @Field(type = FieldType.Long)
    private Long typeId;

    @Field(type = FieldType.Text, analyzer = "ik_smart", searchAnalyzer = "ik_smart")
    private String typeName;

    @Field(type = FieldType.Text, analyzer = "ik_smart", searchAnalyzer = "ik_smart")
    private String carInfo; // 基本信息,关键字要通过基本信息来搜索

}
